<?php
class User extends CI_Model {

	/*
	 * get users
	 */
	function getUsers(){
		$query = $this->db->query('
			SELECT *
			FROM users
			WHERE id_parent = '.$_GET['node'].'
			ORDER BY surname');
		return $query->result();
	}

	/*
	 * get details
	 */
	function getDetails(){
		$query = $this->db->query('
			SELECT *
			FROM users
			WHERE id_node = '.$_GET['idNode']);
		return $query->result();
	}
	
	/*
	 * login user
	 */
	function login(){
		$params = json_decode($_POST['params']);
		$query = $this->db->query('
			SELECT *
			FROM users
			WHERE email = "'.$params->email.'" AND pass = "'.$params->pass.'"');
		return $query->result();
	}
}